#ifndef __TIMER_H
#define __TIMER_H
#include "sys.h"


#define SW_TIMER_SIZE	32
#define SW_TIMER_TIME	10



typedef void(*sw_timer_callback)(void);

typedef struct 
{
	uint8 run;
	uint16 cnt;
	uint16 time;
	sw_timer_callback callback;
}SW_TIMER_INFO;





void TIM3_Int_Init(u16 arr,u16 psc);
void timer3_init(void);
void timer3_start(unsigned int time);
void timer3_stop(void);





void TIM1_PWM_Init(u32 arr,u32 psc);
void pwm_init(void);
void pwm_set_vol(u16 pwm);
u16 pwm_get_vol(void);


void TIM4_Int_Init(u16 arr,u16 psc);

void sw_timer_init(void);
void sw_timer_loop(void);
uint8 sw_timer_start(uint16 ms, uint8 flag, sw_timer_callback callback);
void sw_timer_timeout(uint8 timer_id);
uint8 sw_timer_stop(uint8 timer_id);
void sw_timer_reset(uint8 timer_id);
void sw_timer_update(uint8 timer_id, uint16 ms);


#endif












